package com.gopay.bis.common.trace;

import com.gopay.common.util.JsonUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.IOException;

/**
 * 付款日志
 * Created by hougn on 2017/10/17 0017.
 */
public class PaymentLog {

    private static Log logger = LogFactory.getLog(PaymentLog.class);

    /**
     * 打印日志，用于filebeat读取并保存到kafka
     * @param obj
     * @param kafkaSwitch
     * @throws IOException
     */
    public static void info(Object obj, String kafkaSwitch) throws IOException {
        if(kafkaSwitch.equals("on")){
            logger.info(JsonUtils.toJson(obj));
        }
    }
}
